//
//  SelectColorViewController.m
//  testSyntextApp
//
//  Created by MICHAEL on 15/7/21.
//  Copyright (c) 2015年 kyy. All rights reserved.
//

#import "SelectColorViewController.h"
#import "ViewController.h"
@interface SelectColorViewController ()<UITableViewDelegate,UITableViewDataSource>
@property UITableView *mainTableView;
@end

@implementation SelectColorViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.mainTableView=[[UITableView alloc]initWithFrame:self.view.frame];
    [self.view addSubview:self.mainTableView];
    self.mainTableView.dataSource=self;
    self.mainTableView.delegate=self;


    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark table view delegate
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier=@"abc";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];

    if (!cell) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];

    }
    cell.textLabel.text=[NSString stringWithFormat:@"%i",indexPath.row];
    


   
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section  {    return 5;

}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    ViewController *view;
    if ([self.navigationController.childViewControllers[0] isKindOfClass:[ViewController class]]) {
        view=self.navigationController.childViewControllers[0];

        view.success([NSString stringWithFormat:@"selkect ==%i",indexPath.row]);


    }

    [self.navigationController popViewControllerAnimated:YES]; 
    
}




/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
